<!--
BSD License
Copyright (c) Hero software.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

 * Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

 * Neither the name Facebook nor the names of its contributors may be used to
   endorse or promote products derived from this software without specific
   prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->


<dom-module id="home-hero-code">
  <template>
    <style>
      :host {
        display: block;
        --app-primary-color: #4285f4;
        --app-secondary-color: black;
        position: absolute;
        margin: 0px;
        padding: 0px;
        top: 0px;
        left: 0px;
        width: 100%;
        height: 100%;
      }
      #code{
        text-align: left;
        overflow: hidden;
        display: block;
        position: absolute;
        top:60px;
        bottom:0px;
        width: 100%;
        font-size: 18px;
        color: #eee;
        background-color: #333;
      }
      app-header {
        position: fixed;
        height: 60px;
        top: 0;
        left: 0;
        width: 100%;
        color: #fff;
        background-color: #3f51b5;
        --app-header-background-front-layer: {
          background-image: url(//app-layout-assets.appspot.com/assets/PharrellWilliams.jpg);
        };
      }
    </style>
    <app-header effects="waterfall resize-title blend-background parallax-background" condenses reveals>
      <app-toolbar id='title'>
        <paper-icon-button icon="arrow-back" on-tap='back'></paper-icon-button>
        <div condensed-title>Quick start</div>
      </app-toolbar>
    </app-header>
    <hero-text-animation-view id = 'code'>
    </hero-text-animation-view>
    </paper-material>
  </template>
  <script>

    Polymer({
      is: 'home-hero-code',
      behaviors: [HeroBehavior,HeroViewController,Polymer.NeonSharedElementAnimatableBehavior],
      properties: {
        sharedElements: {
          value: function() {
            return {
              'hero1': this.$.code
            }
          }
        },
        animationConfig: {
          value: function() {
            return {
              'entry': [{
                name: 'hero-animation',
                id: 'hero1',
                toPage: this
              }, {
                name: 'cascaded-animation',
                animation: 'fade-in-animation',
                nodes: [this.$.back]
              }],

              'exit': [ {
                name: 'cascaded-animation',
                animation: 'fade-out-animation',
                nodes: [this.$.back]
              },{
                name: 'cascaded-animation',
                animation: 'transform-animation',
                transformTo: 'translateY(-100vh)',
                nodes: [this.$.code]
              }]
            };
          }
        }
      },
      on:function(json){
        var that = this;
      },
      ready:function(){
        var that = this;
      },
      viewWillAppear:function(){
        this.$.code.on({
          texts:[
            {text:'安装',size:'30px',type:'word',effect:'bounceInUp',aligment:'center'},
            {text:'安装NodeJS',size:'30px',type:'word',effect:'rollIn1',delay:50},
            {text:'brew install node   //有些高级功能需要node 4.0.0 以上版本',size:'20px',type:'char',effect:'fadeIn',delay:10},
            {text:'使用NPM安装Hero Mobile',size:'30px',type:'word',effect:'rollIn1',delay:10},
            {text:'npm install hero-mobile',size:'20px',type:'char',effect:'fadeIn',delay:50},
            {text:'切换目录到hero-mobile框架下',size:'30px',type:'word',effect:'rollIn1',delay:50},
            {text:'hero-iOS',size:'20px',type:'word',effect:'fadeIn',delay:10,lineHeight:'100%'},
            {text:'hero-android',size:'20px',type:'char',effect:'fadeIn',delay:10,lineHeight:'100%'},
            {text:'hero-js',size:'20px',type:'char',effect:'fadeIn',delay:10,lineHeight:'100%'},
            {text:'    -- h5',size:'20px',type:'char',effect:'fadeIn',delay:10,lineHeight:'100%'},
            {text:'    -- server',size:'20px',type:'char',effect:'fadeIn',delay:10,lineHeight:'100%'},
            {text:'hero-iOS和hero-android中分别对应了Hero mobile框架的Sample代码',size:'30px',type:'word',effect:'fadeIn'},
            {text:'hero-js中的h5是Hero Mobile框架的h5实现，server中nodeJS的代码用来开发，测试、或者做为生产服务器。',size:'30px',type:'word',effect:'fadeIn'},
            {text:'cd hero-js/server',size:'20px',type:'word',effect:'fadeIn',delay:50,lineHeight:'100%'},
            {text:'node her.js',size:'20px',type:'word',effect:'fadeIn',delay:50,lineHeight:'100%'},
            {text:'编码',size:'30px',type:'word',effect:'bounceInUp',aligment:'center'},
            {text:'hero mobile使用一种“无逻辑”的黑科技来简化前端页面的逻辑，具体做法如下：',size:'20px',type:'word',effect:'fadeIn',delay:50,lineHeight:'100%'},
            {text:'1） 在hero框架中的元素，有且只能有一个接口，参数是一个json数据对象。',size:'20px',type:'word',effect:'fadeIn',delay:50,lineHeight:'100%'},
            {text:'2） 在hero框架中的元素必须是一个独立元素，它和任何其它元素无关。',size:'20px',type:'word',effect:'fadeIn',delay:50,lineHeight:'100%'},
            {text:'在上面两条规则下，任何类的代码都可以简单清晰。',size:'20px',type:'word',effect:'fadeIn',delay:50,lineHeight:'100%'},
          ]
        });
      },
      back:function(){
        this.fire('item-click','home');
      }

    });

  </script>

</dom-module>
